#include <my_header.h>
#include <string.h>

ssize_t print_to_one_File(const char* path1, const char* path2){
    int fd1 = open(path1, O_RDWR | O_CREAT | O_TRUNC, 0644);
    ERROR_CHECK(fd1, -1, "open_fd1");
    int fd2 = open(path2, O_RDWR | O_CREAT | O_TRUNC, 0644);
    ERROR_CHECK(fd2, -1, "open_fd2");

    dup2(fd1, STDOUT_FILENO);
    dup2(fd2, STDERR_FILENO);

    printf("Hello\n");
    fprintf(stderr,"World\n");

    fflush(stdout);
    fflush(stderr);

    close(fd1);
    close(fd2);
    return 0;
}

/* Usage:  */
int main(int argc, char* argv[]){                                  
    ARGS_CHECK(argc, 3);
    ssize_t ret = print_to_one_File(argv[1], argv[2]);

    return ret;
}

